{include file="public/meat" title="添加字段"/}
<div class="cx-fex-c">
    <div class="x11 pad-t15 pad-b10">
        <div class="cx-fex-c">
            <div class="layout">
                {include file="config/head" /}
            </div>
        </div>
    </div>
    <div class="x11">
        <fieldset class="cx-field">
            <legend class="cx-field-legend">添加字段</legend>
            <form class="layui-form" role="form" action="" method="post">
                <div class="cx-fex-l mb-10">
                     <div class="x3 t-r">
                         <label class="lab">配置名称</label>
                     </div>
                    <div class="xs8 xl9">
                        <input class="ipt" placeholder="请输入配置名称" name="conf_title" required lay-verify="required|uname|nonum|lang2" type="text" value="{$postdb.conf_title|default=''}">
                    </div>
                </div>
                <div class="cx-fex-l mb-10">
                     <div class="x3 t-r">
                         <label class="lab">配置键名</label>
                     </div>
                    <div class="xs8 xl9">
                        <input class="ipt" placeholder="请输入配置键名" name="conf" required lay-verify="required|ennum|lang6" {$postdb.disabled|default=''} type="text" value="{$postdb.conf|default=''}">
                    </div>
                </div>
                <div class="cx-fex-l mb-10">
                     <div class="x3 t-r">
                         <label class="lab">配置类型</label>
                     </div>
                    <div class="xs8 xl9">
                        <select id="dt_type" class="{required:true}" name="conf_type" required lay-filter="dt_dype">
                            <option {eq name="$postdb.conf_type|default='1'" value="1"}selected="selected"{/eq} value="1">单行文本框</option>
                            <option {eq name="$postdb.conf_type|default=''" value="2"}selected="selected"{/eq} value="2">多行文本框</option>
                            <option {eq name="$postdb.conf_type|default=''" value="3"}selected="selected"{/eq} value="3">单选按钮</option>
                            <option {eq name="$postdb.conf_type|default=''" value="4"}selected="selected"{/eq} value="4">复选框</option>
                            <option {eq name="$postdb.conf_type|default=''" value="5"}selected="selected"{/eq} value="5">下拉菜单</option>
                            <option {eq name="$postdb.conf_type|default=''" value="6"}selected="selected"{/eq} value="6">附件</option>
                        </select>
                    </div>
                </div>
                <div id="dt_typelx" class="cx-fex-l mb-10" {neq name="$postdb.conf_type|default=''" value="6"}style="display: none;"{/neq}>
                     <div class="x3 t-r">
                         <label class="lab">附件类型</label>
                     </div>
                    <div class="xs8 xl9">
                        <input name="conf_typelx" value="1" {eq name="$postdb.conf_typelx|default='1'" value="1"}checked="checked"{/eq} type="radio" title="图片">
                        <input name="conf_typelx" value="0" {eq name="$postdb.conf_typelx|default=''" value="0"}checked="checked"{/eq} type="radio" title="压缩包">
                        <input name="conf_typelx" value="2" {eq name="$postdb.conf_typelx|default=''" value="2"}checked="checked"{/eq} type="radio" title="文档">
                    </div>
                </div>
                <div class="cx-fex-l mb-10">
                     <div class="x3 t-r">
                         <label class="lab">禁止删除</label>
                     </div>
                    <div class="xs8 xl9">
                        <input name="nodel" value="1" type="radio" {eq name="$postdb.nodel|default=''" value="1"}checked="checked"{/eq} title="是">
                        <input name="nodel" value="0" {eq name="$postdb.nodel|default='0'" value="0"}checked="checked"{/eq} type="radio" title="否">
                    </div>
                </div>
                <div class="cx-fex-l mb-10">
                     <div class="x3 t-r">
                         <label class="lab">开发者模式</label>
                     </div>
                    <div class="xs8 xl9">
                        <input name="open" value="0" {eq name="$postdb.open|default='0'" value="0"}checked="checked"{/eq} type="radio" title="是">
                        <input name="open" value="1" {eq name="$postdb.open|default=''" value="1"}checked="checked"{/eq} type="radio" title="否">
                    </div>
                </div>
                <div class="cx-fex-l mb-10">
                     <div class="x3 t-r">
                         <label class="lab">默认值</label>
                     </div>
                    <div class="xs8 xl9">
                        <input class="ipt" placeholder="默认值一般为空" name="conf_value" type="text" value="{$postdb.conf_value|default=''}">
                    </div>
                </div>
                <div id="values" class="cx-fex-l mb-10" {switch name="$postdb.conf_type|default='1'"}{case value="1|2"}style="display: none;"{/case}{/switch}>
                     <div class="x3 t-r">
                         <label class="lab">可选值</label>
                     </div>
                    <div class="xs8 xl9">
                        <textarea class="ipt" rows="3" placeholder="可选值请用英文 ' , ' 分割" name="conf_desc">{$postdb.conf_desc|default=''}</textarea>
                    </div>
                </div>
                <div class="cx-fex-l mb-10">
                     <div class="x3 t-r">
                         <label class="lab">排序值</label>
                     </div>
                    <div class="xs8 xl9">
                        <input class="ipt" placeholder="可以为空，数字大的在前面" name="sort" lay-verify="required|number" type="text" value="{$postdb.sort|default='0'}">
                    </div>
                </div>
                <div class="cx-fex-l mb-10">
                     <div class="x3 t-r">
                         <label class="lab"></label>
                     </div>
                    <div class="xs8 xl9">
                        <input type="hidden" name="__token__" required lay-verify="required" value="{$Request.token}" />
                        <button class="button button-S bg-blue" lay-submit lay-filter="button">立即提交</button>
                    </div>
                </div>
            </form>
        </fieldset>
    </div>
</div>
<div style="height: 20px; overflow: hidden"></div>
{include file="public/js" /}
<script>
    layui.config({
        base: '__ADMIN__/js/'
    }).use('app');
</script>
<script>
    layui.define(['form'], function(exports){
        var layform = layui.form;
        layform.on('select(dt_dype)', function(data){
            if(data.value == 3 || data.value == 4 || data.value == 5){
                $("#values").show();
                $("#dt_typelx").hide();
            }else if(data.value == 6) {
                $("#values").hide();
                $("#dt_typelx").show();
            }else{
                $("#values").hide();
                $("#dt_typelx").hide();
            }
        });
    })
</script>
{include file="public/footer" /}